import { formatTime } from "@/utils";
import i18n from '@/locales/index'
const { t } = i18n.global

export const listColumns = [
  {
    title18: 'hangManage.stationNo', dataIndex: 'stationNo', key: 'stationNo', align: 'center', fixed: 'left', width: 120,
    customCell: (record) => {
      return { class: ['station-coloum', { 'bg': !record.staffNo }] }
    }, resizable: true
  },
  { title18: 'hangManage.stationRole', dataIndex: 'role', key: 'role', align: 'center', width: 120, resizable: true },
  { title18: 'basicData.staff', dataIndex: 'staffNo', key: 'staffNo', align: 'center', width: 120, resizable: true },
  // { title: '姓名', dataIndex: 'staffName', key: 'staffName', align: 'center', width: 90 },
  { title18: 'hangManage.receiveHanger', dataIndex: 'receiveCoatHanger', key: 'receiveCoatHanger', align: 'center', width: 120, resizable: true },
  { title18: 'hangManage.autoUndress', dataIndex: 'autoOutCloth', key: 'autoOutCloth', align: 'center', width: 80, resizable: true },
  { title18: 'hangManage.todayYield', dataIndex: 'produceQty', key: 'produceQty', align: 'right', width: 80, resizable: true }, //产出数量
  { title18: 'hangManage.returnNumber', dataIndex: 'reworkQty', key: 'reworkQty', align: 'right', width: 90, resizable: true },
  { title18: 'hangManage.road', dataIndex: 'roadmap', key: 'roadmap', align: 'center', width: 170, resizable: true },
  { title18: 'hangManage.stockFull', dataIndex: 'stationFull', key: 'stationFull', align: 'center', width: 80, resizable: true },
  { title18: 'hangManage.trackFull', dataIndex: 'masterTrackFull', key: 'masterTrackFull', align: 'center', width: 80, resizable: true },
  { title18: 'hangManage.onTrackNumber', dataIndex: 'onlineQty', key: 'onlineQty', align: 'center', width: 80, resizable: true },
  { title18: 'hangManage.stationIn', dataIndex: 'stationQty', key: 'stationQty', align: 'center', width: 180, resizable: true },
  { title18: 'hangManage.capacity', dataIndex: 'stationCapacity', key: 'stationCapacity', align: 'center', width: 80, resizable: true },
  { title18: 'basicData.processName', dataIndex: 'processName', key: 'processName', align: 'center', width: 90, resizable: true },
  { title18: 'basicData.processNo', dataIndex: 'processCode', key: 'processCode', align: 'center', width: 70, resizable: true },

  { title18: 'hangManage.makeNo', dataIndex: 'moNo', key: 'moNo', align: 'center', width: 100, resizable: true },
  { title18: 'basicData.styleNo', dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 90, resizable: true },
  { title18: 'basicData.productType', dataIndex: 'productType', key: 'productType', align: 'center', width: 90, resizable: true },
  {
    title18: 'basicData.styleInfo', dataIndex: 'poNo', key: 'poNo', align: 'center', width: 90,
    customRender: ({ record }) => {
      let { color, size } = record
      return `${color || ''}${color && size ? ',' : ''}${size || ''}`
    }, resizable: true
  }
]

export const editStationRule = {
  role: [
    { required: true, message: t('other.selectSiteRole'), trigger: 'change' }
  ],
  stationCapacity: [
    { required: true, message: t('other.pleaseInputCapacity'), trigger: 'change' }
  ],
  stationQty: [
    { required: true, message: t('other.enterInOrbit'), trigger: 'change' }
  ],
  staffNo: [
    { required: true, message: t('common.pleaseInput'), trigger: 'change' }
  ],
}

export const roadmapColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 60, fixed: 'left',
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('hangManage.scheduledNo'), dataIndex: 'scheduleBillNo', key: 'scheduleBillNo', align: 'center', width: 140, ellipsis: { showTitle: true }, fixed: 'left', sorter: true, resizable: true },
  { title: t('hangManage.makeNo'), dataIndex: 'moNo', key: 'moNo', align: 'center', ellipsis: { showTitle: true }, resizable: true, width: 100, },
  { title: t('basicData.styleNo'), dataIndex: 'styleNo', key: 'styleNo', align: 'center', ellipsis: { showTitle: true }, resizable: true , width: 90,},
  { title: t('basicData.color'), dataIndex: 'color', key: 'color', align: 'center', ellipsis: { showTitle: true }, resizable: true , width: 80,},
  { title: t('basicData.size'), dataIndex: 'size', key: 'size',align: 'center', ellipsis: { showTitle: true }, resizable: true, width:80, },
  { title: t('hangManage.poNo'), dataIndex: 'poNo', key: 'poNo', align: 'center', ellipsis: { showTitle: true } , resizable: true, width: 80,},
  { title: t('hangManage.bedNo'), dataIndex: 'cutterNo', key: 'cutterNo', align: 'center', ellipsis: { showTitle: true } , resizable: true, width: 80,},
  { title: t('hangManage.cut'), dataIndex: 'tailorBill', key: 'tailorBill',align: 'center', ellipsis: { showTitle: true }, resizable: true, width: 80, },
  { title: t('hangManage.road'), dataIndex: 'roadMapName', key: 'roadMapName',align: 'center', ellipsis: { showTitle: true }, resizable: true, width: 100, }, 
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center', width: 130, fixed: 'right' }
]

export const stationHangerColumns = [
  {
    title: t('other.siteSort'), dataIndex: 'coatInStationNo', key: 'coatInStationNo', align: 'center', width: 90,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('other.HangerNo'), dataIndex: 'hangerNo', key: 'hangerNo', align: 'center', width: 120 },
  { title: t('hangManage.makeNo'), dataIndex: 'moNo', key: 'moNo', align: 'center', width: 120 },
  { title: t('basicData.styleNo'), dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 120 },
  // { title: t('basicData.productType'), dataIndex: 'productType', key: 'productType', align: 'center', width: 120 },
  {
    title: t('basicData.styleInfo'), dataIndex: 'info', key: 'info', align: 'center', width: 120,
    customRender: ({ record }) => {
      let { color, size } = record
      return `${color || ''}${color && size ? ',' : ''}${size || ''}`
    }
  },
  { title: t('other.packages'), dataIndex: 'quantity', key: 'quantity', align: 'center', width: 100 },
  {
    title: t('hangManage.intoStationTime'), dataIndex: 'time', key: 'time', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  { title: '本站工序', dataIndex: 'noName', key: 'noName', align: 'center', width: 170 },
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center', width: 70 }
]

export const roleColorList = [
  { name: t('hangManage.bridgeStation'), color: 'tag-purple', value: '1' },
  { name: t('hangManage.hangerStation'), color: 'tag-green', value: '2' },
  { name: t('hangManage.sewStation'), color: 'tag-blue', value: '3' },
  { name: t('hangManage.saveStation'), color: 'tag-orange', value: '4' },
  { name: t('hangManage.checkStation'), color: 'tag-cobalt', value: '5' },
  { name: t('hangManage.emptyHangerStation'), color: 'tag-cyan', value: '6' },
  { name: t('other.reworkStation'), color: 'tag-pink', value: '7' },
]

export const editPutawayRule = {
  colorCode: [
    { required: true, message: t('other.selectColor') }
  ],
  sizeCode: [
    { required: true, message: t('other.selectSize') }
  ],
  quantity: [
    { required: true, message: t('other.HangerNo') },
    { pattern: /^[0-9][0-9]*$/, message: t('other.intOnly'), trigger: 'change' }
  ]
}

export const onOrbitHangerColumns = [
  {
    title: t('other.inOrbitSort'), dataIndex: 'coatInStationNo', key: 'coatInStationNo', align: 'center', width: 90,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('other.HangerNo'), dataIndex: 'hangerNo', key: 'hangerNo', align: 'center', width: 120 },
  { title: t('hangManage.makeNo'), dataIndex: 'moNo', key: 'moNo', align: 'center', width: 120 },
  { title: t('basicData.styleNo'), dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 120 },
  // { title: t('basicData.productType'), dataIndex: 'productType', key: 'productType', align: 'center', width: 120 },
  {
    title: t('basicData.styleInfo'), dataIndex: 'info', key: 'info', align: 'center', width: 120,
    customRender: ({ record }) => {
      let { color, size } = record
      return `${color || ''}${color && size ? ',' : ''}${size || ''}`
    }
  },
  { title: t('other.packages'), dataIndex: 'quantity', key: 'quantity', align: 'center', width: 100 },
  {
    title: t('other.inOrbitTime'), dataIndex: 'time', key: 'time', align: 'center', width: 170,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD HH:mm:ss')
    }
  },
  { title: '下一站', dataIndex: 'nextStationNo', key: 'nextStationNo', align: 'center', width: 90 },
  { title: '下一道工序', dataIndex: 'noName', key: 'noName', align: 'center', width: 170 }, 
  { title: t('common.operate'), dataIndex: 'operate', key: 'operate', align: 'center', width: 70 }
]

export const otherColumns = [
  {
    title: t('common.sequenceNo'), dataIndex: 'index', key: 'index', align: 'center', width: 70,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('other.pipeline'), dataIndex: 'lineNo', key: 'lineNo', align: 'center', width: 150 },
  { title: t('layout.start'), dataIndex: 'check1', key: 'check1', align: 'center', width: 120 ,filterMultiple:true},
  { title: t('other.bridgeStationLogin') , dataIndex: 'check2', key: 'check2', align: 'center', width: 120 },
]